home *** CD-ROM | disk | FTP | other *** search
- Path: news.crystalball.com!news
- From: Larry Weiss <lfw@oc.com>
- Newsgroups: comp.lang.c
- Subject: Re: Newbie doesn't understand compiler error
- Date: Fri, 01 Mar 1996 17:56:59 -0600
- Organization: crystalball.com
- Message-ID: <31378ECB.3B81@oc.com>
- References: <Pine.SUN.3.91.960301153010.11258B-100000@pioneer.uspto.gov>
- NNTP-Posting-Host: external.oc.com
- Mime-Version: 1.0
- Content-Type: text/plain; charset=us-ascii
- Content-Transfer-Encoding: 7bit
- X-Mailer: Mozilla 2.0 (Win16; I)
-
- Max Schubert wrote:
- >
- > I have just started to work with two different learning C books. They
- > both have programs to copy and compile as I go along. Twice I have
- > received this error from cc when attempting to compile two separate
- > programs on SunOS 4.1.2:
- >
- > #include <stdio.h>
- > void do_heading(char *filename);
- > int line, page;
- > main( int argv, char *argc[] ) <<- Compiler states "Syntax error at or near
- > { word type char."
- >
- > Do I need to update my compiler?
- >
- > ANY help would be greatly appreciated.
-
- First off, you may have made a typo here, but the correct declaration of main() is
-
- main( int argc, char *argv[] )
- ^ ^
-
- The compiler that Sun provides with SUNOS 4.1 does not support function
- declarations of the type you are using. This method was introduced into
- the language at the most recent major standardization cycle.
- You will need to either use a different compiler, or translate any function
- prototypes into the older form of argument declaration. For example, code the
- declaraction of main() as:
-
- main( argc, argv )
- int argc;
- char *argv[];
- {
- ...
- }
-